Skip to content

fix(storage): persist inline-data cleanup in CleanAbandonedData - #364

Open
agonizerq wants to merge 1 commit into
pgsty:mainfrom
agonizerq:fix/clean-abandoned-data-inline-persist
Open

agonizerq wants to merge 1 commit into
pgsty:mainfrom
agonizerq:fix/clean-abandoned-data-inline-persist

Conversation

@agonizerq

Copy link
Copy Markdown

What

CleanAbandonedData removes abandoned inline data directories from the in-memory xl.meta (xl.data.remove(...)), serializes the modified metadata into newBuf, but then writes the original buffer buf back to disk:

if xl.data.remove(dirs...) {
    newBuf, err := xl.AppendTo(metaDataPoolGet())
    if err == nil {
        defer metaDataPoolPut(newBuf)
        return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf) // BUG: writes buf
    }
}

As a result the inline-data cleanup never persists: the abandoned inline entries remain in the stored xl.meta and reappear on every subsequent read.

Fix

Write newBuf (the serialized, cleaned metadata) instead of buf:

        return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), newBuf)

Scope / impact

  • One-line correctness fix; no behavior change for the data-dir cleanup path (which deletes on-disk directories directly).
  • Affects only the inline-data branch of CleanAbandonedData (reached via healing / mc admin heal). Single-drive deployments that never run heal are unaffected.
  • No data is lost either way (the bug was that cleanup was a no-op, not that it removed live data); the object remains readable.

Note

Identified by DeepSeek (AI-assisted code review) during an investigation into intermittent object corruption, and submitted from this account.

Signed-off-by: agonizerq agonizerq@users.noreply.github.com

CleanAbandonedData removes abandoned inline data directories from the
in-memory xl.meta (xl.data.remove), serializes the modified metadata
into newBuf, but then writes the ORIGINAL buffer (buf) back to disk.
As a result the inline-data cleanup never persisted and abandoned
inline entries reappear on the next read.

Write newBuf instead of buf so the cleaned metadata is what gets
persisted to xl.meta.

Signed-off-by: agonizerq <agonizerq@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant